﻿#region Using Statements
using System;
using GameBase.Inputs;
using Microsoft.Xna.Framework;
#endregion

namespace StarFox.Inputs
{
    /// <summary>
    /// 
    /// </summary>
    public class StarFoxVibration
    {
        #region Fields

        VibrationState vibration;

        #endregion

        #region Constructor

        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="vibration">Basic gamepad vibration management functions.</param>
        public StarFoxVibration(VibrationState vibration)
        {
            this.vibration = vibration;
        }

        #endregion

        #region Start, Pause, Resume, Cancel

        /// <summary>
        /// Starts gamepad vibration for a given player.
        /// </summary>
        /// <param name="playerIndex">Player for which set gamepad vibration.</param>
        /// <param name="leftMotor">The speed of the left motor, between 0.0 and 1.0.</param>
        /// <param name="rightMotor">The speed of the right motor, between 0.0 and 1.0.</param>
        /// <param name="duration">The duration of the gamepad vibration.</param>
        public void Start(PlayerIndex playerIndex, float leftMotor, float rightMotor, TimeSpan duration)
        {
            vibration.Start(playerIndex, leftMotor, rightMotor, duration);
        }

        /// <summary>
        /// Pauses gamepad vibration for all players.
        /// </summary>
        public void Pause()
        {
            vibration.Pause();
        }

        /// <summary>
        /// Resumes gamepad vibration for all players.
        /// </summary>
        public void Resume()
        {
            vibration.Resume();
        }

        /// <summary>
        /// Cancels gamepad vibration for all players.
        /// </summary>
        public void Cancel()
        {
            vibration.Cancel();
        }

        #endregion
    }
}
